Component({
  options: {

  },
  properties: {
    lists: Array,
    page: String
  },
  methods:{
    make(e) {
      let id = e.target.id;
      let route = getCurrentPages()[0].route;
      let status = e.currentTarget.dataset.status;
      if (status == 0) {
        let title;
        if (route == 'pages/makechef/makechef') {
          title = '抱歉，厨师已被预约！'
        } else {
          title = '抱歉，包间已被预定！'
        }
        wx.showToast({
          title: title,
          icon: 'none'
        })
        return
      }
      this.triggerEvent('make', id)
    },
    redDetail(e){
      let route;
      let page = this.data.page;
      let id = e.currentTarget.id;
      
      if(page == "makeroom"){
        route = '/pages/roomdetail/roomdetail?id=' + id
      }else{
        route = '/pages/chefdetail/chefdetail?id=' + id
      }
      wx.navigateTo({
        url: route,
      })
    }
  }
})